/* 
 *
 * The Trip
 *
 * Jose Ricardo Bustos Molina
 *
 * */

#include <iostream>
#include <iomanip>

using namespace std;

double o(double d);

int main(){
	int n;
	double v[1000];
	cin >> n;
	cout << "\t" << o(9.019) << " " << o(9.015) << endl;
	while(n!=0){
		double avg = 0;
		for(int i=0; i<n; ++i){
			cin >> v[i];
			avg+=v[i];
		}
		avg/=n;
		cerr << "\t" << avg << endl;
		double c1 = 0;
		double c2 = 0;
		for(int i=0; i<n; ++i){
			double diff = o(v[i]-avg);
			if(diff<0) c1-= diff;
			else c2+= diff;
		}
		cerr << c1 << ":" << c2 << endl;
		if(c2>c1) c1=c2;
		cout << "$"  << fixed << setprecision(2) << c1 << endl;

		cin >> n;
	}
}

double o(double d){
	return (double)(long)(d*100)/100;
}
